home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1996 February: Tool Chest / Apple Developer CD Series Tool Chest February 1996 (Apple Computer)(1996).iso / Tool Chest / OS Utilities / ShowInitIcon / Usage & History < prev   
Encoding:
Text File  |  1995-05-30  |  1.6 KB  |  34 lines  |  [TEXT/MMCC]

  1. // ----------------------------------------------------------------------------------------------------------------
  2.  
  3. Should I use it as a standalone code resource or link it into my INIT?
  4.  
  5. I recommend linking the code to your INIT resource, because it's easier and cleaner, *provided* that your INIT resource is
  6. written properly, that is, it is destroyed once startup is over. If your INIT installs trap patches, then the code for the trap
  7. patches should be compiled into a separate resource (or code fragment, on the PowerPC) and only the code for the patches
  8. should remain resident. Filling the System heap with old INIT code isn't cool.
  9.  
  10. If you decide to use this code as a standalone resource, here is a snippet that shows how to load and call it:
  11.  
  12. Handle        theResource;
  13.  
  14. theResource = Get1Resource('Code', 7000);
  15. if (theResource)
  16.     ((pascal void (*) (short, Boolean)) *theResource) (myIconFamilyID, true);
  17.  
  18. Note that I don't call HLock because the resource is marked as Locked, and I don't call ReleaseResource because the 
  19. INIT resource file is going to be closed after the INIT executes, unloading all resources.
  20.  
  21. // ----------------------------------------------------------------------------------------------------------------
  22.  
  23. History:
  24.  
  25. 1.0        Initial release
  26. 1.0.1    Modified to work with MPW C compiler (replaced variables at absolute address with macros)
  27.         Removed dependency on precompiled headers
  28.         Thanks to Devon Hubbard, Martin Minow, Jason Proctor.
  29.  
  30. // ----------------------------------------------------------------------------------------------------------------
  31.  
  32. François Pottier <pottier@dmi.ens.fr>
  33. May 30th, 1995
  34.